home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
veced100.zip
/
VECEDIT.DOC
< prev
next >
Wrap
Text File
|
1995-01-19
|
55KB
|
1,152 lines
▓▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓▓
▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓
▓▓ ▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓
▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓
▓▓ ▓ ▓▓▓ ▓ ▓▓▓ ▓▓ ▓ ▓ ▓
▓ ▓▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓
▓ ▓ ▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓
▓ ▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓
▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓
Vecedit vector editing package, first release version.
Vecedit v2.00, Texedit v1.00, DOC file v1.00.
Copyright 1995, Jason P. Hoerner. All rights reserved. Vecedit is
FREEWARE. As such, no fee may be charged in any way for copying,
downloading, or using Vecedit. Vecedit may not be included in any
PD/Shareware pack without prior consent of the author. The author is not
liable for any damages caused by the use or misuse of Vecedit under any
circumstances.
*************************************************************************
*************************************************************************
*************************************************************************
Table of contents:
INTRODUCTION- WHY USE VECEDIT?
SECTION 1- VECEDIT= VECTOR OBJECT EDITOR
I. 2D editor
A. Basic keyboard commands
B. How the mouse works
C. Editing modes
D. Geometric transformations
E. Copying/ pasting 2D objects
F. Saving 2D objects
G. Additional considerations
II. Creating vector primitives
A. The prism
B. The pyramid
C. Solids of revolution
III. Viewing vector primitives
A. The <view> command
B. Global configuration options
IV. Playing with pretty colors
A. Modifying colors
B. Blending colors
C. Blending for Lambert (lightsource) shading
D. Saving/ loading palettes
V. File operations
A. Saving objects
B. Loading objects
C. Importing objects
VI. Wireframe editor
A. Basic keyboard commands
B. How the mouse works
C. Pieces (imported objects)
D. Geometric transformations
E. Deleting polygons/ edges
F. Creating polygons
G. Merging edges- NOT recommended!
H. Creating point-point edges
I. Static information
J. Dynamic information
K. Free form edge creation
L. Constrained edge creation
M. Group points for depth sorting
SECTION 2- TEXEDIT= COLOR, TEXTURE, GOURAD SHADING EDITOR
I. File operations
A. Texture files- important information
B. Loading
C. Saving files
II. Loading bitmaps
A. The RAW file format
B. Allocation of memory for bitmaps
C. Loading bitmaps
D. Viewing bitmaps
E. Removing bitmaps
III. 3D solid editor
A. Basic keyboard commands
B. How the mouse works
C. Changing polygon colors
D. Texture mapping
E. Gourad shading
F. Dead polygons and creases
G. Removing texture from a polygon
*************************************************************************
*************************************************************************
*************************************************************************
INTRODUCTION, FOREWORD, ETC.
Hello, Jason P. Hoerner (Grey Cat/ CORE) typing. What is this
thing you have downloaded? It is the best non-commercial vector editing
package I know of. Best of all it is FREEWARE. Use it and distribute
it any way you like as long as you do not charge money for it and all
original files are kept intact. Also, if you use Vecedit to create cool
objects for a demo or game, I'd love it if you give me a greeting!
This package is intended to be a complete editing system for the
creation of vector objects for realtime graphics. This package does not
do raytracing, nor does it support super huge objects. The product that
you have is not crippleware--it is identical to the version I am using
here at home. It took me around 5 months to code both parts of Vecedit.
What's C00L about Vecedit?
All graphics are 320x240 Xmode for square pixels
Support for reasonably large objects (500 polygons).
Supports three primitives: prisms, pyramids, and solids of revolution
Importing/ merging objects together
Complete set of geometric transformations
Advanced method of depth sorting
Polygons with arbitrary number of sides
Special geometric constraints to insure coplanar polygons
Lightsource (Lambert) shading
Gourad shading with vertex normals (no crappy depth shading)
Specialized gourad shading options (creases)
Texture mapping
What suckz about Vecedit?
Doesn't support any common object storage formats- C source is provided
as a shell for creating a program to convert Vecedit objects to any
format.
Has a few minor bugs (not enough error checking)
Poor user interface (difficult to learn, help is not very good--
but it is very easy to use and powerful once mastered).
I am releasing Vecedit as freeware rather than shareware so that
people who cannot afford 3D Studio (or anything) will have a powerful tool
for creating vector objects for demos. Also, I think that freeware is a
good thing (greets to Tran--PMODE!). I do NOT plan on coding support for
any common formats. I have included some C source to load/convert
objects, and the user can use this source to create a conversion utility.
If you come up with a cool generalized conversion utility, I encourage you
to send it to me for a release with an update of the package.
I don't really have time to offer extensive support, upgrades, or
advice to anyone using Vecedit. I may have a future release if I get
enough suggestions. I also may create a FAQ or updated DOC file for the
editor, so feel free to send me questions by Email. Don't expect a
personal response though. Alternatively, questions may be posted to the
pc demo newsgroup (comp.sys.ibm.pc.demos) on Usenet (preferred). I will
try to respond to these as long as I am in school. My signature is:
Jason P. Hoerner
jhoerner@umr.edu
(Grey Cat/ CORE)
The use of vecedit requires a basic knowledge of 3D graphics. I
would recommend knowing about 3D cartesian coordinates, backface culling
principles, and cross products (vector products). Learning to use
Vecedit will require several hours of effort. Following are some
abbreviations I commonly use:
Polys= polygons Normals= normal vectors Points= vertices
Although I had announced a 3D animation package to be included
with Vecedit, I decided that it wasn't ready to be released (a lot of
bugs). This animation program will probably be released in a few weeks or
whenever I get around to it.
I encourage you to give Vecedit a try. I am sick of seeing demos
with objects that are ripped off. Vecedit is extremely powerful and can
create anything you can imagine. Another advantage of vecedit is that
it's MUCH cheaper than 3d-studio! Look out for CORE's upcoming demo (to
be released at the NAID demo compo in April 1995). It will feature many
cool objects created in Vecedit!
*************************************************************************
*************************************************************************
*************************************************************************
SECTION 1-- VECEDIT- THE VECTOR EDITOR
The purpose of the vector editor is to allow the creation of vector
objects. A vector object is defined as an object composed of points and
flat polygons. In my vector editor, the primitive is an edge. Each edge
is defined by the two points it is connected to. Also, each edge can be
connected to polygons. The reason for this choice of data structure
is that my vector engine is based on a scanline algorithm. The basic
strategy for creating a vector object is to create all the edges of the
object and then connect polygons to the resulting framework. Before
getting into the advanced stuff, we should start with the built-in
primitive objects which are useful as building blocks for more complicated
objects.
*************************************************************************
I. 2D editor
The 2D editor is an extremely simple tool used to create flat geometric
shapes. Flat geometric shapes are used to create primitive objects.
Everything is an integer in the editor. Do not try to feed floating
point numbers when asked for input!
A. Basic keyboard commands
'D'= input a description of the 2D object (up to 20 chars).
The description is saved in 2D object save files.
'G'= access global 2D editing functions. These functions are
the geometric transformations and object copy/paste.
'M'= change the mode (affects the way the mouse behaves).
'O'= change 2D object being edited (kind of worthless idea--
normally you only edit one object anyway).
'P'= manually create a point at a specified location. Useful
only if your mouse is too sensitive or something.
'Q'= quit 2D editor. Q almost always works to quit out of
something in any of the editors.
'X'= also quit out of 2D editor. Use 'Q' instead, probably.
ESC= this will quit too. This will work anywhere in the vector
editor.
'S'= change the snap of the mouse. Use this to align the mouse
motion to a given integer multiple.
Arrow keys= move coordinate system around
B. How the mouse works
The thing to remember when using the mouse is that the left
button CREATES NEW POINTS. The right mouse button SNAPS TO THE NEAREST
EXISTING POINT. A note about clicking in the mouse routines: whenever
clicking, the routines respond to the click and will not click again until
the button is released.
C. Editing modes
There are four editing modes (selected by pressing 'M'). These
modes affect what the right mouse button does in editing:
mode 0= connecting stuff
This mode is used when creating edges. To create an edge, use
this mode. Right click on an existing point. Then you have two
options. Right click on another existing point to create a point
to point edge. Left click to create a new point and the edge
will be connected to the new point.
mode 1= delete point
Right click on an existing point and the point and all edges
connected to the point are deleted.
mode 2= delete edge
Right click on the two points of an edge and it will be deleted.
mode 3= move point
Right click on a point to select it to be moved. Left click on
the location you want to move the point to.
D. Geometric transformations
These are accessed through the global options ('G' key).
Everything is self-explanatory except the scaling. In scaling you have
the option of inputting fractions instead of integers, i.e. "3/4". It
even checks for divide by zero (whoopee). Note that for ratios bigger
than 1, improper fractions (such as 9/7) should be used. Normal integers
work fine as well.
E. Copying/ pasting 2D objects
These options are also accessed through the global options. The
first object is object zero. Once a 2D object is edited, the next object
is initialized. So if you do something with the object zero, object 1 can
then be accessed. These commands are also self explanatory. Copying is
useful if you mess up a 2D object and want to dissect it without losing
the original.
F. Saving 2D objects
This is done through the save/load 2D objects menu option in the
main menu. When saving objects, DO NOT INCLUDE AN EXTENSION! To select
items in the menu for loading (this applies to the 3D object loading code
as well), the following keys are used:
UP/DOWN ARROWS= move up or down the list
Number keys= move to multiple of 10 (instead of PGUP/PGDN)
ENTER= select object to load
PGUP/PGDN= pageup or pagedown
G. Additional considerations
What kind of objects do you need to create in the 2D editor? Most
of the time you will want convex objects because they are easier to depth
sort. There are ways to depth sort non convex shapes as well, although
it requires some work. There are three types of useful 2D objects:
1. Closed objects- closed geometric shapes. Made up of an equal
number of points and vertices. Used to create
pyramids or prisms.
2. Open polylines- A polyline with TWO ends. NOT closed. There
should be one more vertex than edges. Used to
create "totem" solids of revolution (such as
chess pieces). The polylines will be rotated
about the Y-axis on the screen. Thus, all the
points must have positive X coordinates. The
edges of the polyline should be horizontally
simple, meaning a horizontal line drawn across
the screen will cross only one edge. If the
polyline is not horizontally simple, it is
harder (but not impossible) to depth sort.
3. Torus polylines- A polyline which is convex and may or may not
be closed. These also have one more vertex
than edges. Used to create toruses. The key
to creating these is to use the left mouse
button to create a second point on top of an
existing point when making the last edge.
If the polyline is not closed, then you will
end up creating a torus with the middle filled
in. The same rules apply as in 2 for the
coordinates of rotation.
Following is another marvellous example of my ASCII art (did you like the
title :). The diagram below illustrates type 2 and type 3 polylines.
Double lines represent the Y-axis. Note that no base is needed on the
polyline in the example of #2. The totem solid of revolution creator adds
bases to the object if needed. The asterisk represents a double point.
Two points are required to satisfy the requirements. Each edge next to
the asterisk is connected to a DIFFERENT point. Violate the rules and
the program might crash!
Example of #2 Example of #3
║ ║
║\ ║
║ \ ║ -----
║ \ ║ / \
║ │ ║ / \
║ │ ║ / \
║ / ║ * >
║ / ║ \ /
║/ ║ \ /
║\ ║ \ /
║ \ ║ -----
║ ──┐ ║
║ │ ║
║ │ 7 points, 6 edges ║ 7 points, 6 edges
*************************************************************************
II. Creating vector primitives
A. The prism
Select the appropriate selection in the main menu. You will then
have to enter in a bunch of information:
1. Object number- typically this will be the default of zero
2. Base color- color of lower base of prism. Colors range
from 0..255. Zero is the background. 255 is
reserved as an editor color. If you are doing
shading, the colors are grouped by 32's. 0..31
is the first set of colors. 32..63 is the second
set of colors, etc. You can't change the number
of shades used for shading (I like 32 colors).
3. Top Base color- color of upper base of object
4. Side colors of object- colors around sides of prism
5. Scale numerator- a scale factor for the polyline. This is
the numerator for the scale factor. In my
coordinate system, everything is divided by 4
during normalization (to reduce roundoff in
rotation). Thus, I recommend making the size
4 times larger than you want the object to appear
on screen.
6. Scale denominator- obvious.
7. Vertex coordinates- The X,Y,Z coordinates of the center of
the upper base of the object. Z must be
positive. The bottom base is centered at 0,0,0.
The X and Y can be put off center to create
oblique prisms.
8. Top base scale factor- The top base can be scaled to be a
different size than the bottom base. Top base
scaling is applied after the polyline scaling of
parts 6 and 7.
9. Flip order?- Totally random chance. After you create
a prism, you simply must look at it and see if it
looks right (see the view option, section III).
If it doesn't look right the first time, enter
the opposite of what you did the first time. The
reason for this is the inability of the prism
routine to figure out which way the normals should
go for backface culling.
If you get an error message saying "ERROR CREATING POLYLINE FROM 2D
OBJECT, SORRY!" this means that the 2D object was designed incorrectly.
See design guidelines in Section I-G. The error checking will not
necessarily catch all errors!
B. The pyramid
The pyramid is about the same as the prism, except a little
simpler. The options are all the same except that there is no top base
scale factor because the top of the pyramid is the vertex.
C. The solid of revolution
This is the most complicated primitive. There are two types of
solids of revolution, "totem" solids of revolution and "torus" solids of
revolution. An example of a "totem" is a pawn chess piece. An example
of a "torus" is a torus. Once again, there is crap to enter:
1. Object number- same as above.
2. Low base color- the color of the base with the lower Y
3. High base color- the color of the base with the higher Y
4. Side colors- pretty obvious.
5. Scale numerator/denominator- scaling for the polyline
6. Steps- number of steps for the solid of revolution. If you
make this two big you might crash the program
by overflowing the limit on polygons.
7. Group point creation (Totem/ Stepped)- You will find out
later what group points are. Choose stepped if
you want to make a torus, otherwise choose totem.
If you choose Stepped, some more extra information is needed:
8. Kill bases- this determines whether or not you have a torus
that's filled in the middle. Respond 'Y' to
have a torus with no middle
9. Flip order- Once again, look to see if it is right.
*************************************************************************
III. Viewing vector primitives
A. The <view> command
If you have a vector object loaded or created, you can select the
"view" option by pressing 'V' in the main menu. The following keys are
used in the view mode:
ARROW KEYS= change position of object
'+/-'= change distance to object
'T'= determine the frame rate of the object-wait several seconds
'X' or 'Q'= exit from view mode
B. Global configuration options
Press 'G' in the main menu to get to these. There are some
statistics and a couple of options. The most important option is the
shading flag, which turns lightsource shading on or off. Initially
shading is off. The window size for view mode can also be set here.
Also, there is another option, the global poly color and automatic poly
coloring option. These options affect how polygons are created in the
wireframe editor. If automatic coloring is on, the global color is
automatically applied to polygons that are created (instead of having the
user manually enter the color).
*************************************************************************
IV. Playing with pretty colors
This stuff is for playing with the palette. The same palette
functions are also implemented in the Texedit executable.
A. Modifying colors
The numbers above the palette represent the color number 0..255.
The part of the palette that is visible may be shifted by pressing the
left or right arrow keys. To select a color to modify, press the number
BELOW the palette color. Press 'R', 'G', or 'B' to select red, green,
or blue to modify. The left and right arrows modify the color value by 1.
The up and down arrows modify the color value by 5. Press 'S' to save the
modified color or 'Q' to cancel the modifications.
B. Blending colors
The color blending feature linearly interpolates color shades
between two given colors. Simply input the first and last color indexes.
C. Blending for Lambert (lightsource) shading
For Lambert shading, the colors should be blended from 1 to 31,
33 to 63, 65 to 95, etc. The "zero" colors (0,32,64, etc) are not used
by the shading algorithm. The shading algorithm works by ANDing the color
value with 11100000b to clear the low 5 bits. A color value from 1..31 is
calculated and ORed with the color to produce the final value.
D. Saving/ loading palettes
Select the save or load option. The file load menu is the same
as that for saving or loading 2D files. Palettes are for 18 bit colors,
i.e. the palette numbers are from 0..63 and are stored RGB, RGB, etc.
*************************************************************************
V. File operations
A. Saving objects
This is the same as saving for 2D objects. I recommend saving
often should the rare crash occur (actually, every recorded crash in the
latest version has been a result of bad input by the user :).
B. Loading objects
Same as for 2D objects of course.
C. Importing objects
Importing objects is an EXTREMELY useful technique. Importing an
object loads another object into the current one. Each imported object
is known as a "piece" and can be geometrically manipulated separately in
the 3D wireframe editor. Importing an object is done the same way as
loading. If no object is loaded yet, importing is the same as loading.
*************************************************************************
VI. Wireframe editor
The wireframe editor is the most important and complicated part
of the vector editor. The wireframe editor is designed to generate and
edit arbitrary objects. The wireframe editor can not be entered unless
there is an object loaded. If you like starting from scratch on objects,
you can create a dummy object with one polygon to build off of.
It's time for some more comments about how stuff is created in
this editor. The basic primitive is the edge. Becoming proficient at
creating edges is vital to creating anything cool. Polygons are created
by specifying the edges to which the poly should be connected.
A. Basic keyboard commands
Here is a complete list of all the keys used in the wireframe
editor. The exact functions of the keys will be elaborated later on.
Keys used in "Edge Creation Mode" are not on this list.
'+' and '-'= move object closer or further away.
ARROW KEYS= The arrow keys have two functions. They can be
used to either rotate or translate the object.
'A'= toggles the function of the arrow keys
'C'= enter edge creation mode
'D'= used for deletion of edges or polygons
'F'= Finish it- deletes disconnected edges and normals (reducing
size of output file). WARNING- DON'T DO THIS UNTIL YOU
ARE DONE WITH THE OBJECT!
'H'= Toggle backface culling of edges
'G'= Global editing options (geometric transforms/ normal
recalculation).
'M'= Merge edges (not a recommended feature).
'N'= Create a new polygon
'P'= Switch pieces (imported objects)
'R'= Regroup- changes group points (used for depth sorting).
'U'= Unmark a single edge or polygon
'X', 'Q', ESC= Quit from wireframe editor
SPACE BAR= Cycle marked edge or polygon- try it!
B. How the mouse works
In the wireframe editor, the left mouse button is used to select
edges. Edges are marked by selecting the two points that make up the
edge. The right mouse button is used to select polys. Polys are marked
by selecting any three different points that make up the poly. The
selection routines are designed to snap to the nearest point. There are
many circumstances where it is necessary to mark more than one edge or
polygon. The key thing to remember is that edges and polys cannot be
marked at the same time. If you have been marking polys (with the right
mouse button) and then click on a point (with the left mouse button),
all polys will be unmarked, so be careful! Another nifty feature: when
in the wireframe editor (when not in edge creation mode), a set of
connected edges may be specified by clicking once on each adjacent point
in order. Basically, after an edge is marked, the SECOND point of the
edge is remarked. Thus, the next point marked can specify another edge.
This feature is useful when marking a set of edges for a polygon.
C. Pieces (imported objects)
Whenever an object is imported into the current object, the two
parts can be operated on separately. The different parts of an object
are called "pieces." Whenever the object is saved, the piece information
is NOT retained. Also, when any destructive editing operations are
performed, the piece information is NOT retained. Examples of destructive
operations are deleting polygons or edges, using the "finish it" command,
and merging edges. It is recommended that once pieces are created, you
immediately position them where they belong using geometric
transformations (discussed below). To switch between the main object and
different pieces simply press the 'P' key. There can be up to 20 pieces
at a time.
D. Geometric transformations
Geometric transformations always operate on the currently visible
piece or the main object. The transformations are described below.
1. 'M'= Mirror- Mirroring can be done on the X, Y, or Z
coordinates. This is self-explanatory.
2. 'R'= Rotation- Rotation can be done about the X, Y, and Z
axes. I recommend only rotating about one axis
at a time, otherwise the effect of the rotation
is difficult to predict. The rotation order
is X, Y, then Z. After rotation, it is
recommended that normals are recalculated (see
below). The angles range from 0..1024
representing a complete circle. Press enter to
cancel the rotation.
3. 'S'= Scaling- Scaling is the same as in 2D. Scaling can
be done on all three axes. Fractions (not
floating point!) can be entered for scaling
factors. If asymmetric scaling is done
(different scale on the axes), it is
recommended that normals are recalculated.
Pressing enter for the Y or Z scale factor will
cause the program to use the scale entered for
the X scale. The best way to cancel scaling is
to enter a division by zero, i.e. "1/0".
4. 'T'= Translation- Self explanatory. Note that in my
coordinate system, the positive 'X' axis points
to the right, the positive 'Y' axis points
DOWNWARD, and the positive 'Z' axis points into
the screen.
E. Deleting polygons
Now is a good time to introduce some new concepts about the
wireframe editor. There are three different colors of edges in the
editor. Purple edges are edges which are connected to two polygons.
Yellow edges are connected to only one polygon. Red edges are connected
to zero polygons. Marked edges or polygons are highlighted by white.
Why does this information matter? The "Finish it" command will delete
all red edges in a drawing (these are not necessary). Thus, make sure
not to "Finish it" if there are any red edges you want to keep.
Deleting polygons is very simple. All you do is mark the polygon
you want to delete and press 'D'. If there is more than one polygon
marked, only the first one marked is deleted (and all others are
unmarked).
Deleting edges is the same. Edges to be deleted must be red or
you will not be allowed to delete them. Simply mark the edge and press
'D'.
F. Creating polygons
Creating polygons is almost as easy as deleting. Simply mark the
edges that are to be part of the polygon. An easy way to see where polys
need to be created is by looking at the color. A group of yellow or red
edges might need a polygon created (if you delete a polygon off one of the
primitive objects, you will notice how the color helps). Polygons CAN be
created using edges that are already purple. The program will generate
a new edge on the old one for the extra polygon.
In order to allow the program to calculate the normal vector of
the new polygon, you must define the first two edges according to the left
hand rule. This means that when you curl the fingers of your left hand
along the first marked edge toward the second marked edge, the normal
vector will be in the direction of your thumb. Here is a cheesy diagram:
The normal of this polygon The normal of this polygon
is into the page/screen. will be out of the page/screen.
_______
/ | /\
Edge 1 / | Edge1 / \ Edge 2
/ | / \
/ | / \
< | / /
\ | \ /
Edge 2 \ | \ /
\________| \ /
\/
Note: if the first two edges you mark are collinear, then the program
will crash. You've been warned!
G. Merging edges
Merging edges is an old feature that is not very useful (there are
other ways to do the same thing that are faster). I will briefly explain
how it works. In order to merge edges, you must have two separate edges
which exactly overlap and are both yellow. Typically, this can happen
when importing two pieces which you want to fit together. Mark the two
edges and hit 'M' to merge them into one edge.
H. Creating point-point edges
Now is a good time to explain edge creation mode. To enter edge
creation mode, press 'C' in the wireframe editor. Press 'C' again to
leave edge creation mode. Following is a list of the keys that are
specific to this mode:
'1'= Select point-point edge creation mode
'2'= Select free edge creation mode
'3'= Add static information
'#'= Remove static information
'4'= Add dynamic information
'$'= Remove dynamic information
'5'= Add free edge creation constraints
'%'= Remove constraints
'E'= Create edge (either point-point or free)
'S'= Save (keep) a free edge that is being created
'T'= Trash (do not keep) a free edge that is being created
Edges must be connected to two points. The point-point edge creation mode
is for creating an edge between two existing points. Mark two points with
the RIGHT mouse button while in point-point edge creation mode. Press 'E'
to create the edge.
I. Static information
Static information is basically geometric information that can be
obtained about the object being created. The reason why it is called
static is because it is information about parts of the object that already
exist. The next section, dynamic information, concerns geometric
relationships between a new edge being created and the rest of the object.
Static information is created in the free edge creation mode by pressing
'3' and can be removed by pressing '#' (note that #= SHIFT + 3, at least
on my keyboard). What type of information created depends on what is
marked:
SINGLE POINT= returns the location in 3D coordinates of the marked point.
LEFT CLICK TWO POINTS= returns the distance between the two points. Note
that this works even if the two points are an
edge.
RIGHT CLICK TWO POINTS= returns the vector between the two points.
MARK TWO EDGES= returns the dot product between the two edges. The dot
product is scaled -1000..1000, so divide by 1000 to get
the normalized dot product.
MARK FOUR EDGES= returns the dot product between the normal vectors of
the planes defined by the 4 edges. The first two edges
define one plane and the third and fourth edges define
the other plane.
What can you do with this information? Here are some suggestions. The
location of a single point can be useful for centering the object about
a certain point (use translation). The distance between two points is
useful for creating new edges that have a similar length to existing
edges. The vector between two points is useful for figuring out how to
translate the pieces of an object to align them in some way. Up to
30 pieces of static info may be displayed at a time (I recommend writing
down important numbers on scratch paper while you work).
J. Dynamic information
Dynamic information is information given about an edge that is
being created in free edge creation mode. The information is updated as
a free edge is being created, hence the name dynamic. Dynamic edges are
created by pressing '4' and removed by pressing '$'. Following are the
types of dynamic information, based on what is marked:
SINGLE POINT= returns the distance from the single marked point
SINGLE EDGE= returns the dot product between the new edge being created
and the marked edge.
TWO EDGES= returns the dot product between the new edge being created and
the normal vector of the plane defined by the two marked
edges.
Some uses of dynamic information? The distance between points can be used
to triangulate the position of the endpoint of an edge. The angle (dot
product) between an edge can be used to produce stuff at a certain angle.
The angle between the edge and a plane is useful for making an edge that
is perpendicular to the plane (line it up so the angle between the edge
and the plane normal is zero degrees, corresponding to a dot product of
plus or minus 1. Up to 30 pieces of dynamic info may be displayed at a
time.
K. Free form edge creation
Free form edge creation is the creation of an edge from an
existing point and a new point. The new point is specified in 3D space
using the mouse. To enter free form edge creation mode, right click on
an existing point. Then press 'E' to create the edge. A new command bar
will appear on the bottom of the screen with numbers '1' through '8'.
Numbers '1' through '6' are used to select basic coordinate motion. When
in these motion modes, the mouse is used to move the edge around. Moving
up or right will increase coordinates, while down and left will decrease
coordinates. If you want to move the mouse around freely, press '7'. In
order to create good edges in the free mode, you should rotate the object
around so you can see how the edge relates to the object. Also, dynamic
information can be very helpful for figuring out the placement of edges.
Option '8' allows one to change the length of an edge without affecting
its direction. When the edge is where you want it, press 'S' to save it.
Press 'T' to trash the edge if you want to cancel.
L. Constrained edge creation
Constrained edge creation is the most powerful and important tool
for the creation of edges. Constrained edges is the tool which allows
the creation of parallel lines and coplanar multisided polygons.
Constraints force an edge to meet some geometric requirements.
Constraints are chosen by pressing '5' and cancelled by pressing '%'.
There are two types of constraints:
EDGE CONSTRAINT= Mark one edge. Any free edge created will be parallel
to this edge.
PLANE CONSTRAINT= Mark two edges. Any free edge created will have its
second endpoint contained in the plane defined by the
two edges.
The geometrically inclined will note that constraining by a plane
eliminates one degree of freedom of the location of the endpoint.
Constraining by an edge eliminates two degrees of freedom. Any valid
combination of constraints (no more than three degrees of freedom taken
from the end point) is allowed. The table below explains it:
Constraints: Deg. Freedom Motion available:
─────────────────────────────────────────────────────────────────
PLANE 2 [XY],[XZ],[YZ]
PLANE-PLANE 1 [X],[Y],[Z]
PLANE-PLANE-PLANE 0 CREATED AUTOMATICALLY
EDGE 1 [X],[Y],[Z]
EDGE-PLANE 0 CREATED AUTOMATICALLY
Note that if moving in a certain direction causes a huge change in the
location of the edge endpoint, the routine may refuse to move it in that
direction. If this happens, move it along some other axis! Learning to
use constraints is the ONLY way to become efficient at creating objects
and to create coplanar points for polygons.
Once again, choose 'S' to save it or 'T' to trash it. Note that
the length cannot be modified when working with constrained edges.
M. Group points for depth sorting
Group points are a special invention of mine to improve the
effectiveness of a simple depth sorting routine. I have not heard of
anyone doing anything similar, so I will give a detailed explanation of
the concept.
Normal depth sorting methods work in one of a few ways. One way
is to depth sort polygons based on an arbitrarily chosen vertex of the
polygon. A second method is to choose to sort by either the farthest or
nearest vertex of the polygon. A third method is to sort based on an
average of the vertices of the polygon. A fourth method is to do a full
painter's algorithm which is extremely slow, maybe some sort of BSP-
Tree which is extremely complicated, or a z-buffer algorithm which is
also kind of slow. The first three options above rarely produce correct
depth sorting, even within reasonably simple objects. The last few are
difficult to implement and slower.
The group point idea is to physically specify the exact point that
a polygon or group of polygons will be sorted by. It is possible to
create fairly complicated objects doing this that will be consistently
depth sorted from any angle. The commands for manipulating group points
are given below, followed by some advice on choosing group points. Note
that in the wireframe editor, the group point of the first marked poly is
displayed in the upper left corner of the screen (bet you were wondering
what those coordinates were). The key to press to modify group points is
'R', meaning "Regroup." There are then three options:
'1'= Combine. This command is used to combine several polys so
they are sorted by the same group point. At least
two polys must be marked. Each poly after the
first is set for the group point of the first.
'2'= New Group. This command is used to create new groups. Mark
a poly or group of polys. A new group point will
be created at the geometric center of the points
that make up the marked polys. Each of the
marked polys will then be set for the new group
point.
'3'= Move Group. This command is used to arbitrarily position a
group point. For this option to work, there
must be one polygon and a point marked. The
group point of the polygon that is marked
is changed to the point that is marked.
Note that since group points can only be moved to where a point exists, it
is normally necessary to create "construction lines," lines for the sole
purpose of providing a point to select as a group point. Generally,
convex objects work best with a group point in the middle. Group points
for a complex object should be chosen such that the convex pieces of the
object can be consistently sorted. This is done by selecting group points
that both lie on a line which is normal to a plane which completely
separates the two objects.
*************************************************************************
*************************************************************************
*************************************************************************
SECTION 2- TEXEDIT= COLOR, TEXTURE, GOURAD SHADING EDITOR
The purpose of Texedit is to change the colors of an object (you
can't see the colors of polys in the vector editor!). Also, Texedit
is used to gourad shade an object or to put texture maps on the object.
Note that the editor does NOT support both gourad and texture shading at
the same time (although a later version of my engine does :) ).
*************************************************************************
I. File operations
This stuff is almost identical to that in the vector editor. The
only new thing is the texture file.
A. Texture files- important information
In order to provide texture mapping and gourad shading on my
objects, I use a separate file. The reason for this is I wanted to keep
the file formats relatively simple. Also, by having separate files, it
is very easy to get rid of the texture on an object. Texture files have
an extension of ".TEX" while vector files have an extension of ".VEC".
The two files must have the same name and be in the same directory. In
order to remove the texture, simply delete the ".TEX" file. NOTE: Once
gourad shading or texture mapping has been done on an object, it CANNOT
BE GEOMETRICALLY MODIFIED IN VECEDIT. You MUST delete the texture file
if you want to modify the vector object (otherwise it's definitely going
to crash).
B. Loading files
Files are loaded the same as in the vector editor. The loader
will give you a message saying "File AND TEXTURE successfully loaded" if
a texture file was found and loaded, otherwise the standard message,
"File successfully loaded", is given.
C. Saving files
The editor will only save texture files if texture or gourad
shading has been put on the object. The colors on normal vector objects
may be freely modified and saved.
*************************************************************************
II. Loading bitmaps
The Targa (.TGA) file format is used for bitmaps. Bitmaps are
required to be a power of 2 across and less than 63K memory.
A. Allocation of memory for bitmaps
This is kind of tricky because of real mode limitations. My
original real mode algorithm required that the bitmap for a textured
polygon (texture poly) be in the same segment as the texture poly
interpolation information (to reduce the number of segment register
loads). Thus, when a bitmap is loaded, it is necessary to declare the
maximum number of polygons that you want to texturize with the same
bitmap (everything is allocated in the same segment). The bitmap for a
textured polygon is stored in the texture file itself, so the original
bitmap file is no longer needed. When an object with texture mapping is
reloaded, extra memory is allocated for 10 additional texture polygons.
B. Loading bitmaps
Loading bitmaps simply involves selecting the file as usual. Then
simply specify the maximum number of polygons you will want to use the
same bitmap. Note that the palette for bitmaps is not loaded. The user
must take care of the palette.
C. Viewing bitmaps
Choose the bitmap viewing option in the menu. You can then look
at the bitmaps that have been loaded or are part of the objects. The '+'
and '-' keys are used to cycle through the bitmaps. For each bitmap,
the dimensions and number of texture polys used and available is shown.
D. Removing bitmaps
Deleting a bitmap simply deallocates the memory that the bitmap
and texture polys took up. A bitmap can only be deleted if it is
connected to zero texture polygons. Bitmaps that are loaded are NOT saved
in the texture file unless they are on at least one polygon in the object.
Thus, unless memory is a consideration, it is not necessary to delete/
remove bitmaps.
*************************************************************************
III. 3D solid editor
The 3D solid editor is similar to the wireframe editor. Many of
the movement commands are the same. The difference is that this editor
works with solid objects. This editor is designed to allow modification
of colors and to do texture mapping and gourad shading.
A. Basic keyboard commands
ARROW KEYS= rotate or translate the object
'+' or '-'= Move the object closer or further away
'A'= change what the arrow keys do
'C'= change colors on a poly or group of polys
'D'= remove texture mapping or gourad shading from a poly
'G'= Gourad shade the object
'L'= Change visible information about special gourad shading
options (explained later)
'N'= Cycle through edges or polys (Next edge or poly)
'P'= Cycle through edges or polys (Previous edge or poly)
'R'= Unmark something selected in the special gourad shading
options
'S'= Select the marked edges or polys for special gourad shading
options
'T'= Texturize a poly
'U'= Unmark edge or poly
'X' or 'Q'= Quit 3D solid editor
B. How the mouse works
The behavior of the mouse is similar to that in the 3D wireframe
editor. The left mouse button is used to mark edges while the right mouse
button marks polygons.
C. Changing polygon colors
To change the colors on polygons, mark a polygon or group of
polygons and press the 'C' key. The program will then ask for the new
color to make the polys.
D. Texture mapping
To put a texture on a polygon, first you must mark the polygon.
Then it gets complicated. Mark a vertex that is part of the polygon.
This vertex will represent the upper left corner of the bitmap. Then
press the 'T' button to add texture to the polygon. You will then be
asked "Order (1/2)". This represents whether the texture on the polygon
should be clockwise or counterclockwise. The only problem is that this
is random, so you'll have to guess. If it doesn't work the first time,
select the opposite order you did the first time.
E. Gourad shading
Gourad shading is automatically done on the full object when 'G'
is pressed. There are a couple rules for doing gourad shading:
1. DO NOT gourad shade an object that has already been gourad
shaded or that already has a texture polygon on it.
2. DO NOT attempt to gourad shade an object that has flat double
sided polygons. The problem is that the Vertex normal
calculations will crash on this (the net result is a
vertex normal that is zero!).
F. Dead polygons and creases
These are specialized features that my gourad shading algorithm
can do. There are some bugs occasionally when you use these features,
so if it comes out looking wrong, don't use these features (they shouldn't
crash anyway). To see what polygons and edges have been selected for dead
polygons or creases, press the 'L' key (cycles through different
information). To take stuff off one of the lists, press the 'R' key. So
what do these special features do?
DEAD POLYGON-- This polygon is a polygon that is not gourad shaded. This
polygon will be ignored when calculating vertex normals.
CREASE-- A crease is a line where the normal gourad interpolation is
split up to make it look like an object has a sharp edge or crease. In
order to have this feature, it is necessary for a gourad shading algorithm
to have more than one vertex normal corresponding to a given vertex. It
is EXTREMELY complicated to get the program to generate something like
this. Thus there are some rules about creases:
1. A vertex that has more than four edges connected to it can
have either ALL creases or NO creases. The problem is
that it is difficult to determine the relationship of the
edges to one another when there are more than four edges
coming to a point.
2. A vertex with three edges connected to it is allowed to have
any of those edges as creases.
3. A vertex with four edges connected to it can have any number
of creases coming out of it. However, there is a
restriction when there are two edges of the four that are
creases (see next rule).
4. If two of four edges that are connected to a vertex are
creases, then the edges must be opposite one another.
Here is another fabulous ASCII diagram. The xxxxxxx's
are edges that are creases. The * is the vertex.
Allowed NOT Allowed
| x
| x
| x
| x
| x
xxxxxxxxx*xxxxxxxxxx xxxxxxxx*--------
| |
| |
| |
| |
| |
If you violate the rules above, one of three things may happen: you'll
get lucky and it will still look good, it will look bad, or the program
will crash. An example of a use for a crease is to separate the handle of
a cup from the cup itself. A second example of a crease is for a chess
piece, where the neck and head of the chess piece might be separated. See
the included cup and pawn examples to see cool creases.
G. Removing texture from a polygon
To remove texture mapping or gourad shading from a polygon, mark
the polygon and press 'D'.
*************************************************************************
*************************************************************************
*************************************************************************
I hope the above file answers all your questions. If it doesn't, once
again I prefer posted messages rather than Email. Fan Email is graciously
accepted, though :). If you can't figure something out, experiment! All
the keys and features of the editors are listed above, so read the file
again if something doesn't seem to be working. Documentation of the
file formats for ".VEC" and ".TEX" appear in the conversion utility
source, if you are interested.
LATER...
Jason P. Hoerner
jhoerner@umr.edu
(Grey Cat/ CORE)